#ifndef VP8_ENCODER_H
#define VP8_ENCODER_H

#include <vpx/vpx_encoder.h>
#include <vpx/vp8cx.h>
#include <cstdio>
#include <cstdlib>

class VP8Encoder:public EncodeBase {
public:
    VP8Encoder(int width, int height, int fps, int bitrate, VideoEncDataObserver* p = nullptr);
    ~VP8Encoder();
    virtual void encode(void* data, size_t dataSize, long long pts)override;
private:
    bool isInit = false;
    vpx_codec_ctx_t encoder_;
    vpx_codec_enc_cfg_t cfg_;
    vpx_image_t img_;
    int inputWidth_;
    int inputHeight_;
    VideoEncDataObserver* _ob_;
};

#endif // VP8_ENCODER_H
